﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                    xmlns:sys="clr-namespace:System;assembly=mscorlib"
                    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
                    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
                    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
                    xmlns:converters="clr-namespace:dIRca.WP7.Converters"
                    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
                    xmlns:toolkitPrimitives="clr-namespace:Microsoft.Phone.Controls.Primitives;assembly=Microsoft.Phone.Controls.Toolkit">
    <!-- Converters -->
    <converters:DateTimeToString x:Key="DateTimeToStringConverter" />
    <converters:RelativeDateTime x:Key="RelativeDateTimeConverter" />
    <!-- Fonts -->
    <FontFamily x:Key="FontFamilyNormal">/dIRca;component/Fonts/Fonts.zip#monofur</FontFamily>
    <!-- Styles -->
    <Style x:Key="TextBlockBase" TargetType="TextBlock">
        <Setter Property="FontFamily" Value="{StaticResource FontFamilyNormal}"/>
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeNormal}"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="Margin" Value="{StaticResource PhoneHorizontalMargin}"/>
    </Style>
    <Style x:Key="TextNormalStyle" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBase}">
        <Setter Property="TextWrapping" Value="Wrap" />
        <Setter Property="VerticalAlignment" Value="Center" />
    </Style>
    <Style x:Key="TextSmallStyle" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBase}">
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeSmall}"/>
        <Setter Property="TextWrapping" Value="Wrap" />
        <Setter Property="VerticalAlignment" Value="Center" />
    </Style>
    <Style x:Key="TextSubtleStyle" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBase}">
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeSmall}"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneSubtleBrush}"/>
        <Setter Property="TextWrapping" Value="Wrap" />
        <Setter Property="VerticalAlignment" Value="Center" />
    </Style>
    <Style x:Key="PageTitleStyle" TargetType="TextBlock" BasedOn="{StaticResource TextNormalStyle}">
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeExtraLarge}"/>
    </Style>
    <Style x:Key="SmallPivotStyle" TargetType="controls:Pivot">
        <Setter Property="FontFamily" Value="{StaticResource FontFamilyNormal}"/>
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeNormal}"/>
    </Style>
    <Style x:Key="SmallPivotItemStyle" TargetType="controls:PivotItem">
        <Setter Property="FontFamily" Value="{StaticResource FontFamilyNormal}"/>
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeNormal}"/>
    </Style>
    <Style x:Key="SmallPivotHeaderStyle" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBase}">
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeExtraLarge}"/>
    </Style>
    <Style x:Key="SmallPivotListBoxStyle" TargetType="ListBoxItem">
        <Setter Property="FontFamily" Value="{StaticResource FontFamilyNormal}"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
    </Style>
    <Style x:Key="HyperlinkButtonContentStyle" TargetType="HyperlinkButton">
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}" />
        <Setter Property="Background" Value="{StaticResource PhoneBackgroundBrush}" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="HyperlinkButton">
                    <Border Background="Transparent">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                        To="0.5"
                                                        Storyboard.TargetProperty="Opacity"
                                                        Storyboard.TargetName="ContentElement" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill"
                                                                    Storyboard.TargetName="DisabledElement">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border Background="{TemplateBinding Background}"
                            Margin="{StaticResource PhoneHorizontalMargin}"
                            Padding="{TemplateBinding Padding}">
                            <Grid Height="31" Margin="0">
                                <ContentPresenter x:Name="ContentElement"
                                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                Content="{TemplateBinding Content}"
                                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                                <Rectangle x:Name="DisabledElement" />
                            </Grid>
                        </Border>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <!-- DataTemplates -->
    <DataTemplate x:Key="SmallPivotHeaderTemplate">
        <TextBlock
            Foreground="{StaticResource PhoneAccentBrush}"
            Text="{Binding Model.Name}"
            Style="{StaticResource SmallPivotHeaderStyle}"/>
    </DataTemplate>
    <DataTemplate x:Key="MessagesTemplate">
        <toolkit:WrapPanel Orientation="Horizontal">
            <TextBlock Text="[" />
            <TextBlock Text="{Binding TimeStamp, Converter={StaticResource DateTimeToStringConverter}, ConverterParameter=h:mm:ss tt}" Margin="2,0" Style="{StaticResource TextSubtleStyle}"/>
            <TextBlock Text="](" />
            <TextBlock Margin="2,0" Text="{Binding NickName}" TextWrapping="Wrap" Style="{StaticResource TextSubtleStyle}"/>
            <TextBlock Margin="2,0" Text=")->" />
            <TextBlock Margin="2,0" Text="{Binding MessageData}" TextWrapping="Wrap" Style="{StaticResource TextSubtleStyle}"/>
        </toolkit:WrapPanel>
    </DataTemplate>
    <DataTemplate x:Key="ConnectionsTemplate">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <toolkit:WrapPanel Orientation="Horizontal" Grid.Row="0">
                <TextBlock Text="[" />
                <TextBlock Margin="4,0" Text="{Binding Server.DisplayName, Mode=TwoWay}" TextWrapping="Wrap" Style="{StaticResource TextSubtleStyle}" />
                <TextBlock Text="]" />
            </toolkit:WrapPanel>
            <toolkit:WrapPanel Orientation="Horizontal" Grid.Row="1">
                <TextBlock Margin="4,0" Text="{Binding Server.HostName, Mode=TwoWay}" TextWrapping="Wrap" Style="{StaticResource TextSubtleStyle}"/>
                <TextBlock Text=":" TextWrapping="Wrap" Style="{StaticResource TextSmallStyle}" />
                <TextBlock Margin="4,0" Text="{Binding Server.Ports, Mode=TwoWay}" TextWrapping="Wrap" Style="{StaticResource TextSubtleStyle}" />
            </toolkit:WrapPanel>
        </Grid>
    </DataTemplate>
    <DataTemplate x:Key="ServerTemplate">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="120"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <TextBlock Text="Display Name" Style="{StaticResource TextSmallStyle}" Grid.Column="0" Grid.Row="0" />
            <TextBox Text="{Binding DisplayName, Mode=TwoWay}" InputScope="Text" Grid.Column="1" Grid.Row="0" />
            <TextBlock Text="Hostname" Style="{StaticResource TextSmallStyle}" Grid.Column="0" Grid.Row="1" />
            <TextBox Text="{Binding HostName, Mode=TwoWay}" InputScope="EmailSmtpAddress" Grid.Column="1" Grid.Row="1" />
            <TextBlock Text="Ports" Style="{StaticResource TextSmallStyle}" Grid.Column="0" Grid.Row="2" />
            <TextBox Text="{Binding Ports, Mode=TwoWay}" Grid.Column="1" Grid.Row="2" />
            <TextBlock Text="Group" Style="{StaticResource TextSmallStyle}" Grid.Column="0" Grid.Row="3" />
            <TextBox Text="{Binding Group, Mode=TwoWay}" InputScope="Text" Grid.Column="1" Grid.Row="3" />
            <TextBlock Text="Password" Style="{StaticResource TextSmallStyle}" Grid.Column="0" Grid.Row="4" />
            <PasswordBox Password="{Binding Password, Mode=TwoWay}" Grid.Column="1" Grid.Row="4" />
            <TextBlock Text="Auto Connect" Style="{StaticResource TextSmallStyle}" Grid.Column="0" Grid.Row="5" />
            <toolkitPrimitives:ToggleSwitchButton IsChecked="{Binding AutoConnect, Mode=TwoWay}" Grid.Column="1" Grid.Row="5" />
        </Grid>
    </DataTemplate>
    <DataTemplate x:Key="NetworkTemplate">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="120"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <TextBlock Text="Name" Style="{StaticResource TextSmallStyle}" Grid.Column="0" Grid.Row="0" />
            <TextBox Text="{Binding Name, Mode=TwoWay}" InputScope="Text" Grid.Column="1" Grid.Row="0"/>
            <TextBlock Text="Autojoin" Style="{StaticResource TextSmallStyle}" Grid.Column="0" Grid.Row="1" />
            <toolkitPrimitives:ToggleSwitchButton IsChecked="{Binding IsJoinEnabled, Mode=TwoWay}" Grid.Column="1" Grid.Row="1" />
            <TextBlock Text="Channels" Style="{StaticResource TextSmallStyle}" Grid.Column="0" Grid.Row="2" />
            <TextBox Text="{Binding JoinChannels, Mode=TwoWay}" InputScope="Text" Grid.Column="1" Grid.Row="2" />
            <TextBlock Text="Delay (in seconds)" Style="{StaticResource TextSmallStyle}" Grid.Column="0" Grid.Row="3" />
            <TextBox Text="{Binding JoinDelay, Mode=TwoWay}" InputScope="Number" Grid.Column="1" Grid.Row="3" />
            <TextBlock Text="Auto Identify on Connect" Style="{StaticResource TextSmallStyle}" Grid.Column="0" Grid.Row="4" />
            <toolkitPrimitives:ToggleSwitchButton IsChecked="{Binding IsIdentifyEnabled, Mode=TwoWay}" Grid.Column="1" Grid.Row="4"/>
            <TextBlock Text="Identify command" Style="{StaticResource TextSmallStyle}" Grid.Column="0" Grid.Row="5" />
            <TextBox Text="{Binding IdentifyCommand, Mode=TwoWay}" InputScope="Text" Grid.Column="1" Grid.Row="5" />
            <TextBlock Text="Perform commands" Style="{StaticResource TextSmallStyle}" Grid.Column="0" Grid.Row="6" />
            <TextBox Text="{Binding PerformCommands, Mode=TwoWay}" InputScope="Text" Grid.Column="1" Grid.Row="6" TextWrapping="Wrap" AcceptsReturn="True" />
        </Grid>
    </DataTemplate>
</ResourceDictionary>